import React, { PureComponent } from 'react';
import { message, Form, Input } from 'antd';
import { connect } from 'dva';
import SyOrderTableComponent from '../../components/SyOrderTableComponent';
import moment from 'moment';
import { getAuthority, setAuthority } from '../../utils/authority';
import styles from '../../components/SyOrderTableComponent/index.less';

const FormItem = Form.Item;
const { TextArea } = Input;

@Form.create()
@connect(state => ({
  modelState: state.globalAutoCodeRule,
}))
export default class GlobalAutoCodeRule extends SyOrderTableComponent {

  // 缺省
  _initSortion = { sortField: 'id', sortOrder: 'desc', };
  _initPagination = { pageSize: 10, current: 1, };
  _initCriteriaQuery = {};
  _operator = [
  ];

  initSelection() {
    const { dispatch } = this.props;
  }

  componentWillMount() {
    this.initSelection();
    this.setState({
      baseModel: 'globalAutoCodeRule',
      operator: this._operator,
      needSearch: true,
      needAdd: true,
      needEdit: true,
      needDelete: true,
      needTableColumnsOperator: true,
      // addAuth: 'system:user:add',
      // editAuth: 'system:user:edit',
      // deleteAuth: 'system:user:delete',
      needTableCheckbox: true,
      tableBorder: true,
      tableScroll: { y: 800 },
      tableColumns: [
        {
          title: '单据名称',
          dataIndex: 'name',
          width: 180,
          sorter: true,
        },
        {
          title: 'class名称',
          dataIndex: 'className',
          width: 180,
          sorter: true,
        },
        {
          title: '全路径',
          dataIndex: 'classFullName',
          width: 240,
          sorter: true,
          type: 'longString',
        },
        {
          title: '流水号位数',
          dataIndex: 'codeSize',
          width: 120,
        },
        {
          title: '前缀',
          dataIndex: 'prefix',
          width: 120,
        },
        {
          title: '日期格式',
          dataIndex: 'dateReg',
          width: 150,
        },
        {
          title: '后缀',
          dataIndex: 'suffix',
          width: 120,
        },
        {
          title: '当前编号',
          dataIndex: 'currNumber',
          width: 120,
        },
        {
          title: '当前日期',
          dataIndex: 'currDate',
          // width: 150,
        },

      ],
      searchFormItem: [

      ],
      simpleAddFormItem: [
        {
          name: 'name',
          label: '单据名称',
          placeholder: '单据名称',
          type: 'string',
        },
        {
          name: 'className',
          label: 'class名称',
          placeholder: 'class名称',
          type: 'string',
        },
        {
          name: 'classFullName',
          label: '全路径',
          placeholder: '全路径',
          type: 'string',
        },
        {
          name: 'codeSize',
          label: '流水号位数',
          placeholder: '流水号位数',
          type: 'number',
        },
        {
          name: 'prefix',
          label: '前缀',
          placeholder: '前缀',
          type: 'string',
        },
        {
          name: 'suffix',
          label: '后缀',
          placeholder: '后缀',
          type: 'string',
        },
        {
          name: 'dateReg',
          label: '日期匹配',
          placeholder: '日期匹配',
          type: 'string',
        },
        {
          name: 'currNumber',
          label: '当前编号',
          placeholder: '当前编号',
          type: 'number',
        },
        {
          name: 'currDate',
          label: '当前日期',
          placeholder: '当前日期',
          type: 'string',
        },
      ],
      simpleEditFormItem: [
        {
          name: 'name',
          label: '单据名称',
          placeholder: '单据名称',
          type: 'string',
        },
        {
          name: 'className',
          label: 'class名称',
          placeholder: 'class名称',
          type: 'string',
        },
        {
          name: 'classFullName',
          label: '全路径',
          placeholder: '全路径',
          type: 'string',
        },
        {
          name: 'codeSize',
          label: '流水号位数',
          placeholder: '流水号位数',
          type: 'number',
        },
        {
          name: 'prefix',
          label: '前缀',
          placeholder: '前缀',
          type: 'string',
        },
        {
          name: 'suffix',
          label: '后缀',
          placeholder: '后缀',
          type: 'string',
        },
        {
          name: 'dateReg',
          label: '日期匹配',
          placeholder: '日期匹配',
          type: 'string',
        },
        {
          name: 'currNumber',
          label: '当前编号',
          placeholder: '当前编号',
          type: 'number',
        },
        {
          name: 'currDate',
          label: '当前日期',
          placeholder: '当前日期',
          type: 'string',
        },
      ],
    });
  }

  constructor(props) {
    super(props);
  }

  componentDidMount() {
    super.componentDidMount();
  }

}
